From: Carlos Garnacho Date: Sat, 28 Mar 2020 15:38:14 +0000 (+0100) Subject: st: Honor alpha range specified by pango_attr_foreground_alpha_new() X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~751^2^2~20 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=656168543f30b20cd33b456bc39d202a26ec090a;p=gnome-shell.git st: Honor alpha range specified by pango_attr_foreground_alpha_new() This is documented as a value between 1 and 65536. However we were passing a 0 value for 100% transparent colors, which is interpreted as "system inherited" in pango_renderer_get_alpha() docs. Ensure we respect this range by specifying the minimum allowed alpha (1) if the color is fully transparent. If someone notices this 1/65535th change I'll ask him how many pleiades can he count. Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2504 (yes, again). --- diff --git a/src/st/st-private.c b/src/st/st-private.c index e75e10788..70d31ef76 100644 --- a/src/st/st-private.c +++ b/src/st/st-private.c @@ -134,7 +134,16 @@ _st_set_text_from_style (ClutterText *text, if (color.alpha != 255) { - PangoAttribute *alpha = pango_attr_foreground_alpha_new (color.alpha * 255); + PangoAttribute *alpha; + + /* An alpha value of 0 means "system inherited", so the + * minimum regular value is 1. + */ + if (color.alpha == 0) + alpha = pango_attr_foreground_alpha_new (1); + else + alpha = pango_attr_foreground_alpha_new (color.alpha * 255); + pango_attr_list_insert (attribs, alpha); }